package com.zhike.b2b.user.impl;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.StringTokenizer;
import com.saas.biz.authorityMgr.AuthorityInfo;
import com.saas.biz.commen.Encryption;
import com.saas.biz.commen.MD5;
import com.saas.biz.commen.SendMail;
import com.saas.biz.commen.CommGetId;
import com.saas.biz.commen.CommMethodMgr;
import com.saas.biz.companyMgr.CompanyInfo;
import com.saas.biz.companylevelMgr.CompanyLevelInfo;
import com.saas.biz.dao.custDAO.CustomerDAO;
import com.saas.biz.dao.userDAO.UserDAO;
import com.saas.biz.dao.userDAO.UserExt;
import com.saas.biz.paramMgr.ParamInfo;
import com.saas.biz.roleMgr.RoleInfo;
import com.saas.biz.scoreListMgr.ScoreListInfo;
import com.saas.sys.buffer.Buffers;
import com.saas.sys.exp.SaasApplicationException;
import com.saas.sys.log.Logger;
import com.zhike.b2b.dao.Dbtable;

public class UserInfo
{
  Logger log = new Logger(this);
  Buffers inBuffer;
  Buffers outBuffer;
  Dbtable tradeQuery = new Dbtable();
  CommMethodMgr commen = new CommMethodMgr();
  private String regemail;
  ArrayList queryResult = new ArrayList();

  public void setOutBuffer(Buffers paramBuffers)
  {
    this.outBuffer = paramBuffers;
  }

  public Buffers getOutBuffer()
  {
    return this.outBuffer;
  }

  public void setTradeQuery(Dbtable paramDbtable)
  {
    this.tradeQuery = paramDbtable;
  }

  public Dbtable getTradeQuery()
  {
    return this.tradeQuery;
  }

  public ArrayList getQueryResult()
  {
    return this.queryResult;
  }

  public void setQueryResult(ArrayList paramArrayList)
  {
    this.queryResult = paramArrayList;
  }

  public void registerWorkFlow(Buffers paramBuffers)
  {
    this.outBuffer = paramBuffers;
    this.inBuffer = paramBuffers;
    this.log.LOG_INFO("进入registerWorkFlow方法...");
    String str1 = paramBuffers.getString("SESSION_CUST_ID");
    String str2 = paramBuffers.getString("SESSION_USER_ID");
    AuthorityInfo localAuthorityInfo = new AuthorityInfo();
    CompanyLevelInfo localCompanyLevelInfo = new CompanyLevelInfo();
    CompanyInfo localCompanyinfo = new CompanyInfo();
    ParamInfo localParamInfo = new ParamInfo();
    String str3 = "";
    String str4 = "";
    String str5 = "";
    String str6 = "";
    try
    {
      str3 = localParamInfo.getParameter("regemail");
      str4 = localParamInfo.getParameter("examine");
      str5 = localParamInfo.getParameter("default_role");
      str6 = localParamInfo.getParameter("default_level");
    }
    catch (SaasApplicationException localSaasApplicationException)
    {
      localSaasApplicationException.printStackTrace();
    }
    String str7 = "0";
    if ("1".equals(str4))
      str7 = "1";
    localCompanyinfo.updateCustomerStateById(str1, str7);
    updateUserStateById(str2, str7);
    if (("".equals(str5)) || (!"".equals(str6)))
      localCompanyLevelInfo.updateComapny_Level(str1, str6);
    int i = 0;
    if (i != 0)
    {
      this.outBuffer.setInt("RESULT_CODE", -1);
      this.outBuffer.setString("RESULT_INFO", "业务处理失败！");
    }
    else
    {
      this.outBuffer.setInt("RESULT_CODE", 0);
      this.outBuffer.setString("RESULT_INFO", "业务处理成功！");
    }
    this.log.LOG_INFO("退出registerWorkFlow方法...");
  }

  public void addUserInfoAll(Buffers paramBuffers)
  {
    this.outBuffer = paramBuffers;
    this.inBuffer = paramBuffers;
    int i = -1;
    CommGetId localcommGetId = new CommGetId();
    String str1 = localcommGetId.getTradeId("company", "cust_id");
    String str2 = localcommGetId.getTradeId("user_info", "user_id");
    CustomerDAO localCustomerDAO = new CustomerDAO();
    ParamInfo localParamInfo = new ParamInfo();
    String str3 = "";
    String str4 = "";
    String str5 = "0";
    String str6 = "";
    String str7 = "";
    String str8 = "";
    String str9 = "";
    String str10 = "";
    try
    {
      str3 = localParamInfo.getParameter("examine");
      str4 = localParamInfo.getParameter("examine_person");
      str6 = localParamInfo.getParameter("default_level");
      str7 = localParamInfo.getParameter("role_verifyed_company");
      str8 = localParamInfo.getParameter("role_verifyed_person");
      str9 = localParamInfo.getParameter("default_role_person");
      str10 = localParamInfo.getParameter("default_role");
      log.LOG_DEBUG("企业会员注册后要不要审核(examine)=" + str3 + "-----------------------------");
      log.LOG_DEBUG("是否开通审核个人会员验证(examine_person)=" + str3 + "-----------------------------");
      log.LOG_DEBUG("审核通过后赋予企业会员的角色(role_verifyed_company)=" + str7 + "-----------------------------");
      log.LOG_DEBUG("审核通过后赋予个人会员的角色(role_verifyed_person)=" + str8 + "-----------------------------");
      log.LOG_DEBUG("个人会员默认角色(default_role_person)=" + str9 + "-----------------------------");
      log.LOG_DEBUG("企业会员默认角色(default_role)=" + str10 + "-----------------------------");
    }
    catch (SaasApplicationException localSaasApplicationException1)
    {
      localSaasApplicationException1.printStackTrace();
    }
    String str11 = "";
    if (paramBuffers.getString("CUST_TYPE").equals("2"))
    {
      str11 = "select param_value from site_parameter where param_name='default_role_person'";
      if ("0".equals(str4))
      {
        str5 = "1";
        str11 = "select param_value from site_parameter where param_name='role_verifyed_person'";
      }
      localCustomerDAO.setCust_name(paramBuffers.getString("CONTACT_NAME"));
    }
    if (paramBuffers.getString("CUST_TYPE").equals("1"))
    {
      str11 = "select param_value from site_parameter where param_name='default_role'";
      if ("0".equals(str3))
      {
        str5 = "1";
        str11 = "select param_value from site_parameter where param_name='role_verifyed_company'";
      }
      localCustomerDAO.setCust_name(paramBuffers.getString("CUST_NAME"));
    }
    try
    {
      UserDAO localUserDAO = new UserDAO();
      localUserDAO.setUser_id(str2);
      localUserDAO.setUser_name(paramBuffers.getString("USER_NAME"));
      localUserDAO.setCust_id(str1);
      localUserDAO.setCust_name(paramBuffers.getString("CUST_NAME"));
      localUserDAO.setPasswd(paramBuffers.getString("PASSWD"));
      localUserDAO.setUser_type("1");
      localUserDAO.setEparchy_code(paramBuffers.getString("EPARCHY_CODE"));
      localUserDAO.setNickname(paramBuffers.getString("CONTACT_NAME"));
      localUserDAO.setContact_name(paramBuffers.getString("CONTACT_NAME"));
      localUserDAO.setSex(paramBuffers.getString("SEX"));
      localUserDAO.setEmail(paramBuffers.getString("EMAIL"));
      localUserDAO.setUser_state(str5);
      localUserDAO.setWeb_login_tag("1");
      localUserDAO.setPhone(paramBuffers.getString("GROUP_CONTACT_PHONE"));
      localUserDAO.setCellphone(paramBuffers.getString("CELLPHONE"));
      localUserDAO.setWork_depart(paramBuffers.getString("WORK_DEPART"));
      //在此执行SQL语句 --- todo
      ArrayList localArrayList1 = null;
      String str12 = "";
      if ((null != localArrayList1) && (localArrayList1.size() > 0))
      {
    	HashMap localObject = (HashMap)localArrayList1.get(0);
        if (((HashMap)localObject).get("param_value") != null)
          str12 = ((HashMap)localObject).get("param_value").toString();
      }
      localUserDAO.setRole_auth_id(str12);
      i = adduserinfo(localUserDAO);
      Object localObject = "select level_id,level_name from company_level where level_id = (select t.param_value from site_parameter t where t.param_name='default_level')";
      //在此执行SQL语句 --- todo
      ArrayList localArrayList2 = null;
      if ((null != localArrayList2) && (localArrayList2.size() > 0))
      {
        HashMap localHashMap = (HashMap)localArrayList2.get(0);
        localCustomerDAO.setLevel_id(localHashMap.get("level_id") != null ? localHashMap.get("level_id").toString() : "");
        localCustomerDAO.setLevel_name(localHashMap.get("level_name") != null ? localHashMap.get("level_name").toString() : "");
      }
      else
      {
        localCustomerDAO.setLevel_id("");
        localCustomerDAO.setLevel_name("未指定默认级别！");
      }
      localCustomerDAO.setCust_id(str1);
      localCustomerDAO.setCust_type(paramBuffers.getString("CUST_TYPE"));
      localCustomerDAO.setCust_rage(paramBuffers.getString("CUST_RAGE"));
      localCustomerDAO.setGroup_contact_phone(paramBuffers.getString("GROUP_CONTACT_PHONE"));
      localCustomerDAO.setCust_state(str5);
      localCustomerDAO.setEparchy_code(paramBuffers.getString("EPARCHY_CODE"));
      localCustomerDAO.setList_top("1");
      localCustomerDAO.setCommend("0");
      localCustomerDAO.setDisplay("1");
      localCustomerDAO.setEmail(paramBuffers.getString("EMAIL"));
      localCustomerDAO.setRsrv_str1(paramBuffers.getString("RSRV_STR1"));
      localCustomerDAO.setOper_user(str2);
      i += addCustinfoAll(localCustomerDAO);
      this.outBuffer.setString("SESSION_USER_ID", str2);
      this.outBuffer.setString("SESSION_CUST_ID", str1);
      this.outBuffer.setString("SESSION_CUST_NAME", paramBuffers.getString("CUST_NAME"));
      this.outBuffer.setString("SESSION_USER_NAME", paramBuffers.getString("USER_NAME"));
    }
    catch (SaasApplicationException localSaasApplicationException2)
    {
      this.log.LOG_INFO(localSaasApplicationException2.getMessage());
    }
    if (i != 0)
    {
      this.outBuffer.setInt("RESULT_CODE", -1);
      this.outBuffer.setString("RESULT_INFO", "业务处理失败！");
    }
    else
    {
      this.outBuffer.setInt("RESULT_CODE", 0);
      this.outBuffer.setString("RESULT_INFO", "业务处理成功！");
    }
    int j = new CommMethodMgr().selIntByInfoId("site_parameter", "param_value", "param_name", "isSendMail");
    if (j == 1)
      sendMail(paramBuffers, str1);
    this.log.LOG_INFO("退出addUserInfo方法...");
  }

  private boolean sendMail(Buffers paramBuffers, String paramString)
  {
    String str1 = paramBuffers.getString("EMAIL");
    String str2 = paramBuffers.getString("ROOT_PATH");
    String str3 = "会员注册邮箱验证";
    String str4 = "";
    String str5 = "";
    try
    {
      str4 = new Encryption("hli_mail").encrypt(str1);
      str5 = new Encryption("hli_mail").encrypt(paramString);
    }
    catch (Exception localException)
    {
      localException.printStackTrace();
    }
    String str6 = "http://" + str2 + "/member/member_revalidate_success.jsp?27l=" + str4 + "&s=" + str5;
    HashMap localHashMap = new HashMap();
    localHashMap.put("cust_id", paramString);
    localHashMap.put("email", str1);
    localHashMap.put("path", str6);
    localHashMap.put("root_path", str2);
    localHashMap.put("user_name", paramBuffers.getString("USER_NAME"));
    localHashMap.put("cust_name", paramBuffers.getString("CUST_NAME"));
    String str7 = new CommMethodMgr().selStrByInfoId("site_parameter", "param_value", "param_name", "emailtemp");
    String str8 = new RegMail().getMailContent(str7, localHashMap);
    boolean bool = new SendMail().sendMailHtml(str1, str3, str8);
    if (bool == true)
    {
      log.LOG_DEBUG("邮箱验证发送成功。。。。。。。。。。。。。。。。。。。。。。。。。。");
      return true;
    }
    log.LOG_DEBUG("邮箱注册验证发送失败。。。。。。。。。。。。。。。。。。。。。。。。");
    return false;
  }

  public int adduserinfo(UserDAO paramUserDAO)
    throws SaasApplicationException
  {
    UserExt localUserExt = new UserExt();
    String str1 = "";
    String str2 = "";
    str1 = paramUserDAO.getPasswd();
    MD5 localMD5 = new MD5();
    str2 = localMD5.getMD5(str1.getBytes());
    localUserExt.setParam(":VUSER_ID", paramUserDAO.getUser_id());
    localUserExt.setParam(":VUSER_NAME", paramUserDAO.getUser_name());
    localUserExt.setParam(":VCUST_ID", paramUserDAO.getCust_id());
    localUserExt.setParam(":VCUST_NAME", paramUserDAO.getCust_name());
    localUserExt.setParam(":VPASSWD", str2);
    localUserExt.setParam(":VUSER_TYPE", paramUserDAO.getUser_type());
    localUserExt.setParam(":VNICKNAME", paramUserDAO.getNickname());
    localUserExt.setParam(":VCONTACT_NAME", paramUserDAO.getContact_name());
    localUserExt.setParam(":VSEX", paramUserDAO.getSex());
    localUserExt.setParam(":VEMAIL", paramUserDAO.getEmail());
    localUserExt.setParam(":VUSER_STATE", paramUserDAO.getUser_state());
    localUserExt.setParam(":VWEB_LOGIN_TAG", paramUserDAO.getWeb_login_tag());
    localUserExt.setParam(":VGROUP_CONTACT_PHONE", paramUserDAO.getPhone());
    localUserExt.setParam(":VEPARCHY_CODE", paramUserDAO.getEparchy_code());
    localUserExt.setParam(":VROLE_AUTH_ID", paramUserDAO.getRole_auth_id());
    localUserExt.setParam(":VCELLPHONE", paramUserDAO.getCellphone());
    localUserExt.setParam(":VWORK_DEPART", paramUserDAO.getWork_depart());
    tradeQuery.executeBy(localUserExt.insBy("INS_BY_ALL_USER"));
    
    ScoreListInfo localScoreListInfo = new ScoreListInfo();
    String str3 = localScoreListInfo.operScoreList(paramUserDAO.getCust_id(), "100000000000019", paramUserDAO.getUser_id());
    log.LOG_DEBUG(str3);
    return 0;
  }

  public int addCustinfoAll(CustomerDAO paramCustomerDAO)
    throws SaasApplicationException
  {
    UserExt localUserExt = new UserExt();
    localUserExt.setParam(":VCUST_ID", paramCustomerDAO.getCust_id());
    localUserExt.setParam(":VCUST_NAME", paramCustomerDAO.getCust_name());
    localUserExt.setParam(":VCUST_TYPE", paramCustomerDAO.getCust_type());
    localUserExt.setParam(":VCUST_RAGE", paramCustomerDAO.getCust_rage());
    localUserExt.setParam(":VCUST_STATE", paramCustomerDAO.getCust_state());
    localUserExt.setParam(":VEPARCHY_CODE", paramCustomerDAO.getEparchy_code());
    localUserExt.setParam(":VLIST_TOP", paramCustomerDAO.getList_top());
    localUserExt.setParam(":VCOMMEND", paramCustomerDAO.getCommend());
    localUserExt.setParam(":VDISPLAY", paramCustomerDAO.getDisplay());
    localUserExt.setParam(":VCLASS_NAME", paramCustomerDAO.getLevel_name());
    localUserExt.setParam(":VLEVEL_ID", paramCustomerDAO.getLevel_id());
    localUserExt.setParam(":VGROUP_CONTACT_PHONE", paramCustomerDAO.getGroup_contact_phone());
    localUserExt.setParam(":VOPER_USER", paramCustomerDAO.getOper_user());
    localUserExt.setParam(":VEMAIL", paramCustomerDAO.getEmail());
    localUserExt.setParam(":VRSRV_STR1", paramCustomerDAO.getRsrv_str1());
    this.tradeQuery.executeBy(localUserExt.insBy("COMPANY_FREE_IN"));
    return 0;
  }

  public ArrayList getAdminByName(String paramString)
    throws SaasApplicationException
  {
    ArrayList localArrayList = new ArrayList();
    UserExt localUserExt = new UserExt();
    localUserExt.setParam(":VUSER_NAME", paramString);
    localArrayList = localUserExt.selByList("SEL_BY_USERNAME");
    return localArrayList;
  }

  public ArrayList getAdminTypeByName(String paramString)
    throws SaasApplicationException
  {
    ArrayList localArrayList = new ArrayList();
    UserExt localUserExt = new UserExt();
    localUserExt.setParam(":VUSER_NAME", paramString);
    localArrayList = localUserExt.selByList("SEL_ADMINTYPE_BY_USERNAME");
    return localArrayList;
  }

  public ArrayList getByNamePasswd(String paramString)
    throws SaasApplicationException
  {
    UserExt localUserExt = new UserExt();
    localUserExt.setParam(":VUSER_NAME", paramString);
    ArrayList uels = localUserExt.selByList("SEL_CUST_BY_USERNAME");
    return uels;
  }

  public String checkIp(String paramString1, String paramString2)
    throws SaasApplicationException
  {
    ParamInfo localParamInfo = new ParamInfo();
    String str1 = localParamInfo.getParameter("check_IP");
    if (str1.equals("0"))
      return "0";
    ArrayList localArrayList = new ArrayList();
    UserExt localUserExt = new UserExt();
    localUserExt.setParam(":VUSER_NAME", paramString1);
    localArrayList = localUserExt.selByList("SELECL_CHECK_IP_BY_USERNAME");
    if ((localArrayList != null) && (localArrayList.size() > 0))
    {
      HashMap localHashMap = (HashMap)localArrayList.get(0);
      String str2 = "";
      String str3 = "";
      if (localHashMap.get("ip") != null)
        str2 = localHashMap.get("ip").toString();
      if (localHashMap.get("user_type") != null)
        str3 = localHashMap.get("user_type").toString();
      if (str3.equals("1"))
        return "0";
      if (str2.equals(paramString2))
        return "0";
      return "1";
    }
    return "0";
  }

  public void addUserInfo(Buffers paramBuffers)
  {
    this.outBuffer = paramBuffers;
    this.inBuffer = paramBuffers;
    this.log.LOG_INFO("进入addUserInfo方法...");
    int i = -1;
    try
    {
      UserDAO localUserDAO = new UserDAO();
      i = addUserInfo(localUserDAO);
    }
    catch (SaasApplicationException localSaasApplicationException)
    {
      this.log.LOG_INFO(localSaasApplicationException.getMessage());
    }
    if (i != 0)
    {
      this.outBuffer.setInt("RESULT_CODE", -1);
      this.outBuffer.setString("RESULT_INFO", "新增用户业务处理失败！");
    }
    else
    {
      this.outBuffer.setInt("RESULT_CODE", 0);
      this.outBuffer.setString("RESULT_INFO", "新增用户业务处理成功！");
    }
    this.log.LOG_INFO("退出addUserInfo方法...");
  }

  public int addUserInfo(UserDAO paramUserDAO)
    throws SaasApplicationException
  {
    UserExt localUserExt = new UserExt();
    this.tradeQuery.executeBy(localUserExt.insBy("INS_BY_ALL"));
    this.outBuffer.setString("USER_ID", paramUserDAO.getUser_id());
    this.outBuffer.setString("USER_NAME", paramUserDAO.getUser_name());
    this.log.LOG_INFO(" addUserInfo successful !");
    return 0;
  }

  public void addNewUserInfo(Buffers paramBuffers)
  {
    this.outBuffer = paramBuffers;
    this.inBuffer = paramBuffers;
    this.log.LOG_INFO("进入addNewUserInfo方法...");
    int i = -1;
    try
    {
      UserDAO localUserDAO = new UserDAO();
      i = addNewUserInfo(localUserDAO);
    }
    catch (SaasApplicationException localSaasApplicationException)
    {
      this.log.LOG_INFO(localSaasApplicationException.getMessage());
    }
    if (i != 0)
    {
      this.outBuffer.setInt("RESULT_CODE", -1);
      this.outBuffer.setString("RESULT_INFO", "新增用户业务处理失败！");
    }
    else
    {
      this.outBuffer.setInt("RESULT_CODE", 0);
      this.outBuffer.setString("RESULT_INFO", "新增用户业务处理成功！");
    }
    this.log.LOG_INFO("退出addNewUserInfo方法...");
  }

  public int addNewUserInfo(UserDAO paramUserDAO)
    throws SaasApplicationException
  {
    UserExt localUserExt = new UserExt();
    String str1 = "";
    String str2 = "";
    str1 = paramUserDAO.getPasswd();
    MD5 localMD5 = new MD5();
    str2 = localMD5.getMD5(str1.getBytes());
    localUserExt.setParam(":VUSER_NAME", paramUserDAO.getUser_name());
    log.LOG_DEBUG("*****************************///////////////////////" + paramUserDAO.getUser_name() + "*********");
    localUserExt.setParam(":VRSRV_STR3", paramUserDAO.getRsrv_str3());
    this.tradeQuery.executeBy(localUserExt.insBy("INS_BY_ALL"));
    this.outBuffer.setString("USER_ID", paramUserDAO.getUser_id());
    this.outBuffer.setString("USER_NAME", paramUserDAO.getUser_name());
    this.log.LOG_INFO(" addUserInfo successful !");
    return 0;
  }

  public String getUserState(String paramString)
    throws SaasApplicationException
  {
    String str = "";
    ArrayList localArrayList = new ArrayList();
    UserExt localUserExt = new UserExt();
    localUserExt.setParam(":VUSER_ID", paramString);
    localArrayList = localUserExt.selByList("SEL_NAME_BY_IDS");
    if ((localArrayList != null) && (localArrayList.size() > 0))
    {
      HashMap localHashMap = (HashMap)localArrayList.get(0);
      if (localHashMap.get("user_state") != null)
        str = localHashMap.get("user_state").toString();
    }
    return str;
  }

  public String getUserWebLoginTag(String paramString)
    throws SaasApplicationException
  {
    String str = "";
    ArrayList localArrayList = new ArrayList();
    UserExt localUserExt = new UserExt();
    localUserExt.setParam(":VUSER_ID", paramString);
    localArrayList = localUserExt.selByList("SEL_NAME_BY_IDS");
    if ((localArrayList != null) && (localArrayList.size() > 0))
    {
      HashMap localHashMap = (HashMap)localArrayList.get(0);
      if (localHashMap.get("web_login_tag") != null)
        str = localHashMap.get("web_login_tag").toString();
    }
    return str;
  }

  public void genUserInfo(Buffers paramBuffers)
  {
    this.log.LOG_INFO("进入getCustInfo方法...");
    this.outBuffer = paramBuffers;
    String str = paramBuffers.getString("QUERY_PARAM");
    try
    {
      this.log.LOG_INFO("query_param.............." + str);
      if (str.equals(""))
        this.queryResult = genUserInfo();
      else
        this.queryResult = searchUser(str);
    }
    catch (SaasApplicationException localSaasApplicationException)
    {
      this.log.LOG_INFO(localSaasApplicationException.getMessage());
    }
    this.log.LOG_INFO("退出getCustInfo方法...");
  }

  public ArrayList genUserInfo()
    throws SaasApplicationException
  {
    ArrayList localArrayList = new ArrayList();
    UserExt localUserExt = new UserExt();
    localArrayList = localUserExt.selByList("SEL_BY_ALL");
    return localArrayList;
  }

  public void genNoFreeUserInfo(Buffers paramBuffers)
  {
    this.log.LOG_INFO("进入genNoFreeUserInfo方法...");
    this.outBuffer = paramBuffers;
    String str = paramBuffers.getString("QUERY_PARAM");
    try
    {
      if (str.equals(""))
        this.queryResult = genNoFreeUserInfo();
      else
        this.queryResult = searchUser(str);
    }
    catch (SaasApplicationException localSaasApplicationException)
    {
      this.log.LOG_INFO(localSaasApplicationException.getMessage());
    }
    this.log.LOG_INFO("退出getCustInfo方法...");
  }

  public ArrayList genNoFreeUserInfo()
    throws SaasApplicationException
  {
    ArrayList localArrayList = new ArrayList();
    UserExt localUserExt = new UserExt();
    localUserExt.setParam(":VUSER_STATE", "0");
    localArrayList = localUserExt.selByList("SEL_BY_NOFREE");
    return localArrayList;
  }

  public void genOneUserInfo(Buffers paramBuffers)
  {
    this.log.LOG_INFO("进入genOneUserInfo方法...");
    this.outBuffer = paramBuffers;
    String str = paramBuffers.getString("USER_ID");
    try
    {
      this.queryResult = genOneUserInfo(str);
    }
    catch (SaasApplicationException localSaasApplicationException)
    {
      this.log.LOG_INFO(localSaasApplicationException.getMessage());
    }
    this.log.LOG_INFO("退出genOneUserInfo方法...");
  }

  public ArrayList genOneUserInfo(String paramString)
    throws SaasApplicationException
  {
    ArrayList localArrayList = new ArrayList();
    UserExt localUserExt = new UserExt();
    localUserExt.setParam(":VUSER_ID", paramString);
    localArrayList = localUserExt.selByList("SEL_BY_ONE");
    return localArrayList;
  }

  public ArrayList getCustName(String paramString)
    throws SaasApplicationException
  {
    ArrayList localArrayList = new ArrayList();
    UserExt localUserExt = new UserExt();
    localUserExt.setParam(":VUSER_ID", paramString);
    localArrayList = localUserExt.selByList("SEL_BY_USERID_FOR_CUST_NAME");
    return localArrayList;
  }

  public void updateOneUserInfo(Buffers paramBuffers)
  {
    this.log.LOG_INFO("进入updateOneUserInfo方法...");
    this.outBuffer = paramBuffers;
    int i = -1;
    try
    {
      UserDAO localUserDAO = new UserDAO();
      i = updateOneUserInfo(localUserDAO);
    }
    catch (SaasApplicationException localSaasApplicationException)
    {
      this.log.LOG_INFO(localSaasApplicationException.getMessage());
    }
    if (i != 0)
    {
      this.outBuffer.setInt("RESULT_CODE", -1);
      this.outBuffer.setString("RESULT_INFO", "业务处理失败！");
    }
    else
    {
      this.outBuffer.setInt("RESULT_CODE", 0);
      this.outBuffer.setString("RESULT_INFO", "业务处理成功！");
    }
  }

  public int updateOneUserInfo(UserDAO paramUserDAO)
    throws SaasApplicationException
  {
    CommMethodMgr localcommMethodMgr = new CommMethodMgr();
    UserExt localUserExt = new UserExt();
    this.tradeQuery.executeBy(localUserExt.insBy("UPDATE_BY_ONE"));
    return 0;
  }

  public void invalidOneUserInfo(Buffers paramBuffers)
  {
    this.log.LOG_INFO("进入updateOneUserInfo方法...");
    this.outBuffer = paramBuffers;
    int i = -1;
    String str1 = paramBuffers.getString("USER_ID");
    String str2 = paramBuffers.getString("USER_STATE");
    try
    {
      i = invaildOneUserInfo(str1, str2);
    }
    catch (SaasApplicationException localSaasApplicationException)
    {
      this.log.LOG_INFO(localSaasApplicationException.getMessage());
    }
    if (i != 0)
    {
      this.outBuffer.setInt("RESULT_CODE", -1);
      this.outBuffer.setString("RESULT_INFO", "业务处理失败！");
    }
    else
    {
      this.outBuffer.setInt("RESULT_CODE", 0);
      this.outBuffer.setString("RESULT_INFO", "业务处理成功！");
    }
  }

  public int invaildOneUserInfo(String paramString1, String paramString2)
    throws SaasApplicationException
  {
    UserExt localUserExt = new UserExt();
    localUserExt.setParam(":VUSER_ID", paramString1);
    localUserExt.setParam(":VUSER_STATE", paramString2);
    this.tradeQuery.executeBy(localUserExt.insBy("INVALID_BY_ONE"));
    return 0;
  }

  public void UserInfo(Buffers paramBuffers)
  {
    this.log.LOG_INFO("进入DeleteUserInfo方法...");
    this.outBuffer = paramBuffers;
    this.inBuffer = paramBuffers;
    int i = -1;
    String str1 = paramBuffers.getString("USER_ID");
    String str2 = paramBuffers.getString("USER_STATE");
    this.log.LOG_INFO("退出DeleteUserInfo方法..." + str1);
    try
    {
      StringTokenizer localStringTokenizer = new StringTokenizer(str1, "|");
      String str3 = "";
      while (localStringTokenizer.hasMoreTokens())
      {
        str3 = localStringTokenizer.nextToken();
        i = invaildOneUserInfo(str3, str2);
      }
    }
    catch (SaasApplicationException localSaasApplicationException)
    {
      this.log.LOG_INFO(localSaasApplicationException.getMessage());
    }
    if (i != 0)
    {
      this.outBuffer.setInt("RESULT_CODE", -1);
      this.outBuffer.setString("RESULT_INFO", "业务处理失败！");
    }
    else
    {
      this.outBuffer.setInt("RESULT_CODE", 0);
      this.outBuffer.setString("RESULT_INFO", "业务处理成功！");
    }
    this.log.LOG_INFO("退出DeleteUserInfo方法...");
  }

  public ArrayList searchUser(String paramString)
    throws SaasApplicationException
  {
    ArrayList localArrayList = new ArrayList();
    UserExt localUserExt = new UserExt();
    localUserExt.setParam(":VUSER_NAME", "%" + paramString + "%");
    localArrayList = localUserExt.selByList("SEL_BY_SEARCH");
    return localArrayList;
  }

  public ArrayList getUserByCust(String paramString)
    throws SaasApplicationException
  {
    ArrayList localArrayList = new ArrayList();
    UserExt localUserExt = new UserExt();
    localUserExt.setParam(":VCUST_ID", paramString);
    localArrayList = localUserExt.selByList("SEL_USERID_BY_CUSTID");
    return localArrayList;
  }

  public ArrayList getForCustByID(String paramString)
    throws SaasApplicationException
  {
    ArrayList localArrayList = new ArrayList();
    UserExt localUserExt = new UserExt();
    localUserExt.setParam(":VUSER_ID", paramString);
    localArrayList = localUserExt.selByList("SEL_BY_ID_FOR_CUST");
    return localArrayList;
  }

  public void getUserinfoByCust_id(Buffers paramBuffers)
  {
    this.log.LOG_INFO("进入getUserinfoByCust_id方法...");
    this.outBuffer = paramBuffers;
    String str1 = paramBuffers.getString("SESSION_CUST_ID");
    String str2 = paramBuffers.getString("SESSION_USER_NAME");
    try
    {
      if ((str2 == "admin") || (str2.equals("admin")))
        this.queryResult = genUserInfo();
      else
        this.queryResult = getUserinfoByCust_id(str1);
    }
    catch (SaasApplicationException localSaasApplicationException)
    {
      this.log.LOG_INFO(localSaasApplicationException.getMessage());
    }
    this.log.LOG_INFO("退出getUserinfoByCust_id方法...");
  }

  public ArrayList getUserinfoByCust_id(String paramString)
    throws SaasApplicationException
  {
    ArrayList localArrayList = new ArrayList();
    UserExt localUserExt = new UserExt();
    localUserExt.setParam(":VCUST_ID", paramString);
    localUserExt.setParam(":VUSER_STATE", "0");
    localArrayList = localUserExt.selByList("SEL_BY_CUST_ID");
    return localArrayList;
  }

  public ArrayList getUserinfoByCust_id(int paramInt, String paramString)
    throws SaasApplicationException
  {
    paramInt *= 20;
    ArrayList localArrayList = new ArrayList();
    UserExt localUserExt = new UserExt();
    localUserExt.setParam(":VCUST_ID", paramString);
    localUserExt.setParam(":VUSER_STATE", "0");
    localArrayList = localUserExt.selByList("SEL_BY_CUST_ID", paramInt, 20);
    return localArrayList;
  }

  public Map getUserByCustId(String paramString)
    throws SaasApplicationException
  {
    HashMap localHashMap1 = new HashMap();
    UserExt localUserExt = new UserExt();
    localUserExt.setParam(":VCUST_ID", paramString);
    localUserExt.setParam(":VUSER_STATE", "0");
    ArrayList localArrayList = localUserExt.selByList("SEL_CUST_BY_IDX");
    if ((localArrayList != null) && (localArrayList.size() > 0))
      for (int i = 0; i < localArrayList.size(); i++)
      {
        HashMap localHashMap2 = (HashMap)localArrayList.get(i);
        String str1 = localHashMap2.get("user_id").toString();
        String str2 = localHashMap2.get("user_name").toString();
        localHashMap1.put(str1, str2);
      }
    return localHashMap1;
  }

  public ArrayList getUserListByCust(int paramInt, String paramString1, String paramString2)
    throws SaasApplicationException
  {
    paramInt *= 30;
    ArrayList localArrayList = new ArrayList();
    UserExt localUserExt = new UserExt();
    localUserExt.setParam(":VCUST_ID", paramString1);
    localUserExt.setParam(":VUSER_STATE", paramString2);
    localArrayList = localUserExt.selByList("SEL_BY_CUST_ID", paramInt, 30);
    return localArrayList;
  }

  public int getUserNumber(String paramString1, String paramString2)
    throws SaasApplicationException
  {
    ArrayList localArrayList = new ArrayList();
    UserExt localUserExt = new UserExt();
    localUserExt.setParam(":VCUST_ID", paramString1);
    localUserExt.setParam(":VUSER_STATE", paramString2);
    localArrayList = localUserExt.selByList("SEL_BY_CUST_ID");
    if (localArrayList != null)
      return localArrayList.size();
    return 0;
  }

  public ArrayList getUserListByUserState(int paramInt, String paramString)
    throws SaasApplicationException
  {
    paramInt *= 30;
    ArrayList localArrayList = new ArrayList();
    UserExt localUserExt = new UserExt();
    localUserExt.setParam(":VUSER_STATE", paramString);
    localArrayList = localUserExt.selByList("SEL_BY_USER_STATE_ORDER", paramInt, 30);
    return localArrayList;
  }

  public int getUserListByUserState(String paramString)
    throws SaasApplicationException
  {
    ArrayList localArrayList = new ArrayList();
    UserExt localUserExt = new UserExt();
    localUserExt.setParam(":VUSER_STATE", paramString);
    localArrayList = localUserExt.selByList("SEL_BY_USER_STATE_ORDER");
    if (localArrayList != null)
      return localArrayList.size();
    return 0;
  }

  public ArrayList getUserInfoByUserId(String paramString)
    throws SaasApplicationException
  {
    ArrayList localArrayList = new ArrayList();
    UserExt localUserExt = new UserExt();
    localUserExt.setParam(":VUSER_ID", paramString);
    localArrayList = localUserExt.selByList("SEL_DETAL_BY_ID");
    return localArrayList;
  }

  public String getUserNameByCustId(String paramString)
    throws SaasApplicationException
  {
    String str = "";
    HashMap localHashMap = new HashMap();
    ArrayList localArrayList = new ArrayList();
    UserExt localUserExt = new UserExt();
    localUserExt.setParam(":VCUST_ID", paramString);
    log.LOG_DEBUG("cust_id===============" + paramString);
    localArrayList = localUserExt.selByList("SEL_USERNAME_BY_CUSTID");
    if ((localArrayList != null) && (localArrayList.size() > 0))
    {
      localHashMap = (HashMap)localArrayList.get(0);
      str = localHashMap.get("user_name").toString();
    }
    return str;
  }

  public ArrayList getcomName(String paramString)
    throws SaasApplicationException
  {
    ArrayList localArrayList = new ArrayList();
    UserExt localUserExt = new UserExt();
    localUserExt.setParam(":VUSER_ID", paramString);
    localArrayList = localUserExt.selByList("SEL_DETAL_BY_USER_NAME");
    return localArrayList;
  }

  public ArrayList getcomNameByUserId(String paramString)
    throws SaasApplicationException
  {
    ArrayList localArrayList = new ArrayList();
    UserExt localUserExt = new UserExt();
    localUserExt.setParam(":VUSER_ID", paramString);
    localArrayList = localUserExt.selByList("SEL_DETAL_BY_USER_ID");
    return localArrayList;
  }

  public ArrayList getcomNamebyId(String paramString)
    throws SaasApplicationException
  {
    ArrayList localArrayList = new ArrayList();
    UserExt localUserExt = new UserExt();
    localUserExt.setParam(":VUSER_ID", paramString);
    localArrayList = localUserExt.selByList("SEL_DETAL_BY_USER_ID");
    return localArrayList;
  }

  public String getUserNameById(String paramString)
    throws SaasApplicationException
  {
    HashMap localHashMap = new HashMap();
    ArrayList localArrayList = new ArrayList();
    UserExt localUserExt = new UserExt();
    localUserExt.setParam(":VUSER_ID", paramString);
    localArrayList = localUserExt.selByList("GET_USER_NAME_BY_ID");
    String str = "";
    if ((localArrayList != null) && (localArrayList.size() > 0))
    {
      localHashMap = (HashMap)localArrayList.get(0);
      str = localHashMap.get("user_name").toString();
    }
    return str;
  }

  public int getUserNameCount(String paramString)
  {
    ArrayList localArrayList = new ArrayList();
    UserExt localUserExt = new UserExt();
    int i = 0;
    localUserExt.setParam(":VUSER_NAME", paramString);
    localArrayList = localUserExt.selByList("SEL_BY_NAME");
    if (localArrayList != null)
      return 1;
    return 0;
  }

  public int getUserNameExist(String paramString)
    throws SaasApplicationException
  {
    ArrayList localArrayList = new ArrayList();
    UserExt localUserExt = new UserExt();
    localUserExt.setParam(":VUSER_NAME", paramString.trim());
    localArrayList = localUserExt.selByList("SEL_BY_USERNAMEDOUBLE");
    if ((localArrayList != null) && (localArrayList.size() > 0))
      return 1;
    return 0;
  }

  public void userStaeMgr(Buffers paramBuffers)
  {
    this.log.LOG_INFO("进入userStaeMgr方法...");
    this.outBuffer = paramBuffers;
    int i = -1;
    try
    {
      String str1 = paramBuffers.getString("CUST_ID");
      String str2 = paramBuffers.getString("CUST_STATE");
      String str3 = paramBuffers.getString("SESSION_USER_ID");
      i = userStaeMgr(str1, str3, str2);
    }
    catch (SaasApplicationException localSaasApplicationException)
    {
      this.log.LOG_INFO(localSaasApplicationException.getMessage());
    }
    if (i != 0)
    {
      this.outBuffer.setInt("RESULT_CODE", -1);
      this.outBuffer.setString("RESULT_INFO", "业务处理失败！");
    }
    else
    {
      this.outBuffer.setInt("RESULT_CODE", 0);
      this.outBuffer.setString("RESULT_INFO", "业务处理成功！");
    }
  }

  public int userStaeMgr(String paramString1, String paramString2, String paramString3)
    throws SaasApplicationException
  {
    UserExt localUserExt = new UserExt();
    localUserExt.setParam(":VCUST_ID", paramString1);
    localUserExt.setParam(":VSTAFF_ID", paramString2);
    localUserExt.setParam(":VUSER_STATE", paramString3);
    this.tradeQuery.executeBy(localUserExt.insBy("USER_STATE_CHANGE"));
    return 0;
  }

  public void updateUserActiveation(Buffers paramBuffers)
  {
    this.log.LOG_INFO("进入updateUserActiveation方法...");
    this.outBuffer = paramBuffers;
    int i = -1;
    try
    {
      String str = paramBuffers.getString("user_id");
      i = updateUserActiveation(str);
    }
    catch (SaasApplicationException localSaasApplicationException)
    {
      this.log.LOG_INFO(localSaasApplicationException.getMessage());
    }
    if (i != 0)
    {
      this.outBuffer.setInt("RESULT_CODE", -1);
      this.outBuffer.setString("RESULT_INFO", "业务处理失败！");
    }
    else
    {
      this.outBuffer.setInt("RESULT_CODE", 0);
      this.outBuffer.setString("RESULT_INFO", "业务处理成功！");
    }
    this.log.LOG_INFO("退出updateUserActiveation方法...");
  }

  public int updateUserActiveation(String paramString)
    throws SaasApplicationException
  {
    UserExt localUserExt = new UserExt();
    localUserExt.setParam(":VUSER_ID", paramString);
    this.tradeQuery.executeBy(localUserExt.insBy("UPDATE_ACTIVE"));
    return 0;
  }

  public String getCustIdByUserName(String paramString)
    throws SaasApplicationException
  {
    String str = "";
    ArrayList localArrayList = new ArrayList();
    UserExt localUserExt = new UserExt();
    localUserExt.setParam(":VUSER_NAME", paramString);
    localArrayList = localUserExt.selByList("SEL_BY_NAME");
    if ((localArrayList != null) && (localArrayList.size() > 0))
    {
      HashMap localHashMap = (HashMap)localArrayList.get(0);
      str = localHashMap.get("cust_id").toString();
    }
    return str;
  }

  public HashMap getUserInfByName(String paramString)
    throws SaasApplicationException
  {
    HashMap localHashMap = new HashMap();
    ArrayList localArrayList = new ArrayList();
    UserExt localUserExt = new UserExt();
    localUserExt.setParam(":VUSER_NAME", paramString);
    localArrayList = localUserExt.selByList("SEL_BY_NAME");
    if ((localArrayList != null) && (localArrayList.size() > 0))
      localHashMap = (HashMap)localArrayList.get(0);
    return localHashMap;
  }

  public Map getPasswordByName(String paramString)
    throws SaasApplicationException
  {
    ArrayList localArrayList = new ArrayList();
    UserExt localUserExt = new UserExt();
    localUserExt.setParam(":VUSER_NAME", paramString.trim());
    localArrayList = localUserExt.selByList("SEL_BY_NAME");
    String str1 = "";
    String str2 = "";
    HashMap localHashMap1 = new HashMap();
    HashMap localHashMap2 = new HashMap();
    if ((localArrayList != null) && (localArrayList.size() > 0))
      for (int i = 0; i < localArrayList.size(); i++)
      {
        localHashMap2 = (HashMap)localArrayList.get(i);
        if (localHashMap2.get("user_name") != null)
          str1 = localHashMap2.get("user_name").toString();
        if (localHashMap2.get("passwd") != null)
          str2 = localHashMap2.get("passwd").toString();
        localHashMap1.put("user_name", str1);
        localHashMap1.put("passwd", str2);
      }
    return localHashMap1;
  }

  public String getUserWeb_Log(String paramString)
    throws SaasApplicationException
  {
    String str = "";
    ArrayList localArrayList = new ArrayList();
    UserExt localUserExt = new UserExt();
    localUserExt.setParam(":VUSER_ID", paramString);
    localArrayList = localUserExt.selByList("SEL_BY_ONE");
    if ((localArrayList != null) && (localArrayList.size() > 0))
    {
      HashMap localHashMap = (HashMap)localArrayList.get(0);
      if (localHashMap.get("web_login_tag") != null)
        str = localHashMap.get("web_login_tag").toString();
      this.log.LOG_INFO("..." + localArrayList);
    }
    this.log.LOG_INFO("..." + str);
    return str;
  }

  public int getEmailAddrExist(String paramString)
  {
    int i = 0;
    UserExt localUserExt = new UserExt();
    localUserExt.setParam(":VEMAIL", paramString);
    ArrayList localArrayList = localUserExt.selByList("SEL_BY_EMAIL");
    if ((localArrayList != null) && (localArrayList.size() > 0))
    {
      HashMap localHashMap = (HashMap)localArrayList.get(0);
      i = Integer.parseInt(localHashMap.get("ct").toString());
    }
    return i;
  }
/*
  public String getUserJsonData(int paramInt, String paramString1, String paramString2)
    throws SaasApplicationException
  {
    String str1 = "";
    ArrayList localArrayList = new ArrayList();
    UserExt localUserExt = new UserExt();
    localUserExt.setParam(":VCUST_ID", paramString1);
    localUserExt.setParam(":VUSER_STATE", paramString2);
    localArrayList = localUserExt.selByList("SEL_BY_CUST_ID", paramInt, 10);
    JSONArray localJSONArray = new JSONArray();
    JSONObject localJSONObject1 = new JSONObject();
    if ((localArrayList != null) && (localArrayList.size() > 0))
      for (int i = 0; i < localArrayList.size(); i++)
      {
        HashMap localHashMap = (HashMap)localArrayList.get(i);
        String str2 = "";
        String str3 = "";
        String str4 = "";
        String str5 = "";
        String str6 = "";
        String str7 = localHashMap.get("user_id").toString();
        if (localHashMap.get("user_name") != null)
          str2 = localHashMap.get("user_name").toString();
        if (localHashMap.get("phone") != null)
          str3 = localHashMap.get("phone").toString();
        if (localHashMap.get("home_addr") != null)
        {
          str4 = localHashMap.get("home_addr").toString();
          str4 = str4.replaceAll("<[^<>]+>", "");
          if (str4.length() > 20)
            str4 = str4.substring(0, 20) + "...";
        }
        if (localHashMap.get("birthday") != null)
        {
          str5 = localHashMap.get("birthday").toString();
          if (str5.length() > 10)
            str5 = str5.substring(0, 10);
        }
        if (localHashMap.get("email") != null)
          str6 = localHashMap.get("email").toString();
        JSONObject localJSONObject2 = new JSONObject();
        localJSONObject2.put("id", str7);
        localJSONObject2.put("name", str2);
        localJSONObject2.put("phone", str3);
        localJSONObject2.put("addr", str4);
        localJSONObject2.put("email", str6);
        localJSONArray.add(localJSONObject2);
      }
    int i = getUserNumber(paramString1, "0");
    localJSONObject1.put("root", localJSONArray);
    localJSONObject1.put("totalCount", Integer.valueOf(i));
    str1 = localJSONObject1.toString();
    return str1;
  }*/

  public String searchRoleCode(String paramString)
    throws SaasApplicationException
  {
    String str = "";
    ArrayList localArrayList = getUserinfoByCust_id(paramString);
    if ((localArrayList != null) && (localArrayList.size() > 0))
    {
      HashMap localHashMap = (HashMap)localArrayList.get(0);
      if (localHashMap.get("rsrv_str3") != null)
        str = localHashMap.get("rsrv_str3").toString();
      else
        str = "";
    }
    return str;
  }

  public void updateUsrRole(Buffers paramBuffers)
  {
    this.log.LOG_INFO("进入updateUsrRole方法...");
    this.outBuffer = paramBuffers;
    int i = -1;
    String str1 = paramBuffers.getString("USER_ID");
    String str2 = paramBuffers.getString("SESSION_CUST_ID");
    String str3 = paramBuffers.getString("CODE");
    try
    {
      i = updateUsrRole(str1, str2, str3);
    }
    catch (SaasApplicationException localSaasApplicationException)
    {
      this.log.LOG_INFO(localSaasApplicationException.getMessage());
    }
    if (i != 0)
    {
      this.outBuffer.setInt("RESULT_CODE", -1);
      this.outBuffer.setString("RESULT_INFO", "业务处理失败！");
    }
    else
    {
      this.outBuffer.setInt("RESULT_CODE", 0);
      this.outBuffer.setString("RESULT_INFO", "业务处理成功！");
    }
    this.log.LOG_INFO("退出updateUsrRole方法...");
  }

  public int updateUsrRole(String paramString1, String paramString2, String paramString3)
    throws SaasApplicationException
  {
    UserExt localUserExt = new UserExt();
    localUserExt.setParam(":VUSER_ID", paramString1);
    localUserExt.setParam(":VCUST_ID", paramString2);
    localUserExt.setParam(":VROLE_CODE", paramString3);
    this.log.LOG_INFO("==" + localUserExt.insBy("EIDT_TY_ROLE"));
    this.tradeQuery.executeBy(localUserExt.insBy("EIDT_TY_ROLE"));
    return 0;
  }

  public String getUserName(String paramString)
    throws SaasApplicationException
  {
    String str = "";
    ArrayList localArrayList = new ArrayList();
    UserExt localUserExt = new UserExt();
    localUserExt.setParam(":VUSER_ID", paramString);
    localArrayList = localUserExt.selByList("SEL_NAME_BY_IDS");
    if ((localArrayList != null) && (localArrayList.size() > 0))
    {
      HashMap localHashMap = (HashMap)localArrayList.get(0);
      if (localHashMap.get("user_name") != null)
        str = localHashMap.get("user_name").toString();
    }
    return str;
  }

  public int getUserName(String paramString1, String paramString2)
    throws SaasApplicationException
  {
    ArrayList localArrayList = new ArrayList();
    UserExt localUserExt = new UserExt();
    String str = "";
    MD5 localMD5 = new MD5();
    str = localMD5.getMD5(paramString2.getBytes());
    localUserExt.setParam(":VUSER_ID", paramString1);
    localUserExt.setParam(":VPASSWD", str);
    localArrayList = localUserExt.selByList("CHECK_USER_PASSWORD");
    if ((localArrayList != null) && (localArrayList.size() > 0))
      return 1;
    return 0;
  }

  public void modifyOneUserPw(Buffers paramBuffers)
  {
    this.log.LOG_INFO("进入modifyOneUserPw方法...");
    this.outBuffer = paramBuffers;
    int i = -1;
    String str1 = paramBuffers.getString("PASSWORD");
    String str2 = paramBuffers.getString("USER_ID");
    String str3 = "";
    MD5 localMD5 = new MD5();
    str3 = localMD5.getMD5(str1.getBytes());
    this.log.LOG_INFO(str1 + "1111" + str1 + "4444" + str3);
    try
    {
      i = modifyOneUserPw(str3, str2);
    }
    catch (SaasApplicationException localSaasApplicationException)
    {
      this.log.LOG_INFO(localSaasApplicationException.getMessage());
    }
    if (i != 0)
    {
      this.outBuffer.setInt("RESULT_CODE", -1);
      this.outBuffer.setString("RESULT_INFO", "业务处理失败！");
    }
    else
    {
      this.outBuffer.setInt("RESULT_CODE", 0);
      this.outBuffer.setString("RESULT_INFO", "业务处理成功！");
    }
  }

  public int modifyOneUserPw(String paramString1, String paramString2)
    throws SaasApplicationException
  {
    this.log.LOG_INFO("BGEIN+++++++++++++++++++++");
    UserExt localUserExt = new UserExt();
    localUserExt.setParam(":VUSER_ID", paramString2);
    localUserExt.setParam(":VPASSWD", paramString1);
    this.tradeQuery.executeBy(localUserExt.insBy("UPDATE_BY_ONE_PW"));
    this.log.LOG_INFO("END+++++++++++++++++++++");
    return 0;
  }

  public void DeluserStaeMgr(Buffers paramBuffers)
  {
    this.log.LOG_INFO("进入userStaeMgr方法...");
    this.outBuffer = paramBuffers;
    int i = -1;
    try
    {
      String str = paramBuffers.getString("CUST_ID");
      i = DeluserStaeMgr(str);
    }
    catch (SaasApplicationException localSaasApplicationException)
    {
      this.log.LOG_INFO(localSaasApplicationException.getMessage());
    }
    if (i != 0)
    {
      this.outBuffer.setInt("RESULT_CODE", -1);
      this.outBuffer.setString("RESULT_INFO", "业务处理失败！");
    }
    else
    {
      this.outBuffer.setInt("RESULT_CODE", 0);
      this.outBuffer.setString("RESULT_INFO", "业务处理成功！");
    }
  }

  public int DeluserStaeMgr(String paramString)
    throws SaasApplicationException
  {
    UserExt localUserExt = new UserExt();
    localUserExt.setParam(":VCUST_ID", paramString);
    this.tradeQuery.executeBy(localUserExt.insBy("STATE_DELETE_USER"));
    return 0;
  }

  public void DeleteUserInfo(Buffers paramBuffers)
  {
    this.log.LOG_INFO("进入DeleteSaleInfo方法...");
    this.outBuffer = paramBuffers;
    this.inBuffer = paramBuffers;
    int i = -1;
    String str1 = paramBuffers.getString("CUST_ID");
    try
    {
      StringTokenizer localStringTokenizer = new StringTokenizer(str1, "|");
      String str2 = "";
      while (localStringTokenizer.hasMoreTokens())
      {
        str2 = localStringTokenizer.nextToken();
        i = DeluserStaeMgr(str2);
      }
    }
    catch (SaasApplicationException localSaasApplicationException)
    {
      this.log.LOG_INFO(localSaasApplicationException.getMessage());
    }
    if (i != 0)
    {
      this.outBuffer.setInt("RESULT_CODE", -1);
      this.outBuffer.setString("RESULT_INFO", "业务处理失败！");
    }
    else
    {
      this.outBuffer.setInt("RESULT_CODE", 0);
      this.outBuffer.setString("RESULT_INFO", "业务处理成功！");
    }
    this.log.LOG_INFO("退出DeleteSaleInfo方法...");
  }

  public ArrayList getUserListByUser(int paramInt)
    throws SaasApplicationException
  {
    paramInt *= 30;
    ArrayList localArrayList = new ArrayList();
    UserExt localUserExt = new UserExt();
    localArrayList = localUserExt.selByList("SEL_BY_USER_I_W", paramInt, 30);
    return localArrayList;
  }

  public int getUserListByUser()
    throws SaasApplicationException
  {
    ArrayList localArrayList = new ArrayList();
    UserExt localUserExt = new UserExt();
    localArrayList = localUserExt.selByList("SEL_BY_USER_I_W");
    if ((localArrayList != null) && (localArrayList.size() > 0))
      return localArrayList.size();
    return 0;
  }

  public ArrayList getUserListByUser(String paramString)
    throws SaasApplicationException
  {
    ArrayList localArrayList = new ArrayList();
    UserExt localUserExt = new UserExt();
    localUserExt.setParam(":VUSER_ID", paramString);
    localArrayList = localUserExt.selByList("SEL_BY_USER_I_T");
    return localArrayList;
  }

  public ArrayList getOneUser(int paramInt, String paramString)
    throws SaasApplicationException
  {
    paramInt *= 30;
    ArrayList localArrayList = new ArrayList();
    UserExt localUserExt = new UserExt();
    localUserExt.setParam(":VUSER_NAME", "%" + paramString + "%");
    localArrayList = localUserExt.selByList("SEL_BY_USER_I_U", paramInt, 30);
    return localArrayList;
  }

  public int getOneUser(String paramString)
    throws SaasApplicationException
  {
    ArrayList localArrayList = new ArrayList();
    UserExt localUserExt = new UserExt();
    localUserExt.setParam(":VUSER_NAME", "%" + paramString + "%");
    localArrayList = localUserExt.selByList("SEL_BY_USER_I_U");
    if ((localArrayList != null) && (localArrayList.size() > 0))
      return localArrayList.size();
    return 0;
  }

  public void addAdminInfo(Buffers paramBuffers)
  {
    this.outBuffer = paramBuffers;
    this.inBuffer = paramBuffers;
    this.log.LOG_INFO("进入addAdminInfo方法...");
    int i = -1;
    try
    {
      String str1 = paramBuffers.getString("PASSWORD");
      String str2 = paramBuffers.getString("USER_NAME");
      String str3 = paramBuffers.getString("USER_ID");
      String str4 = paramBuffers.getString("CUST_ID");
      String str5 = paramBuffers.getString("USER_STATE");
      String str6 = paramBuffers.getString("WEB_LOGIN_TAG");
      String str7 = "";
      MD5 localMD5 = new MD5();
      str7 = localMD5.getMD5(str1.getBytes());
      i = addAdminInfo(str7, str2, str3, str4, str5, str6);
    }
    catch (SaasApplicationException localSaasApplicationException)
    {
      this.log.LOG_INFO(localSaasApplicationException.getMessage());
    }
    if (i != 0)
    {
      this.outBuffer.setInt("RESULT_CODE", -1);
      this.outBuffer.setString("RESULT_INFO", "新增用户业务处理失败！");
    }
    else
    {
      this.outBuffer.setInt("RESULT_CODE", 0);
      this.outBuffer.setString("RESULT_INFO", "新增用户业务处理成功！");
    }
    this.log.LOG_INFO("退出addAdminInfo方法...");
  }

  public int addAdminInfo(String paramString1, String paramString2, String paramString3, String paramString4, String paramString5, String paramString6)
    throws SaasApplicationException
  {
    UserExt localUserExt = new UserExt();
    localUserExt.setParam(":VPASSWORD", paramString1);
    localUserExt.setParam(":VCUST_ID", paramString4);
    localUserExt.setParam(":VWEB_LOGIN_TAG", paramString6);
    localUserExt.setParam(":VUSER_ID", paramString3);
    localUserExt.setParam(":VUSER_STATE", paramString5);
    localUserExt.setParam(":VUSER_NAME", paramString2);
    this.tradeQuery.executeBy(localUserExt.insBy("INS_BY_ADMIN_USER"));
    return 0;
  }

  public void DeleteUser(Buffers paramBuffers)
  {
    this.log.LOG_INFO("进入DeleteSaleInfo方法...");
    this.outBuffer = paramBuffers;
    this.inBuffer = paramBuffers;
    int i = -1;
    String str1 = paramBuffers.getString("CUST_ID");
    StringTokenizer localStringTokenizer = new StringTokenizer(str1, "|");
    String str2 = "";
    while (localStringTokenizer.hasMoreTokens())
    {
      str2 = localStringTokenizer.nextToken();
      i = DeleteUser(str2);
      i += DeleteUserByCustId(str2);
      i += DeleteUserAllOther(str2);
      i += DeleteInfoListByCustId(str2);
      i += DeleteCustByCustId(str2);
      i += DeleteCust(str2);
    }
    if (i != 0)
    {
      this.outBuffer.setInt("RESULT_CODE", -1);
      this.outBuffer.setString("RESULT_INFO", "业务处理失败！");
    }
    else
    {
      this.outBuffer.setInt("RESULT_CODE", 0);
      this.outBuffer.setString("RESULT_INFO", "业务处理成功！");
    }
    this.log.LOG_INFO("退出DeleteSaleInfo方法...");
  }

  public int DeleteUser(String paramString)
  {
    UserExt localUserExt = new UserExt();
    localUserExt.setParam(":VCUST_ID", paramString);
    this.tradeQuery.executeBy(localUserExt.insBy("DEL_USER_BY_CUST_ID"));
    return 0;
  }

  public int DeleteUserAllOther(String paramString)
  {
    UserExt localUserExt = new UserExt();
    localUserExt.setParam(":VCUST_ID", paramString);
    this.tradeQuery.executeBy(localUserExt.insBy("UP_CUST_ALLOTHERINFO_BY_CUSTID"));
    return 0;
  }

  public int DeleteInfoListByCustId(String paramString)
  {
    UserExt localUserExt = new UserExt();
    localUserExt.setParam(":VCUST_ID", paramString);
    this.tradeQuery.executeBy(localUserExt.insBy("DEL_INFOLIST_BY_CUSTID1"));
    return 0;
  }

  public int DeleteUserByCustId(String paramString)
  {
    UserExt localUserExt = new UserExt();
    localUserExt.setParam(":VCUST_ID", paramString);
    this.tradeQuery.executeBy(localUserExt.insBy("DEL_USER_BY_CUST_ID1"));
    return 0;
  }

  public int DeleteCustByCustId(String paramString)
  {
    UserExt localUserExt = new UserExt();
    localUserExt.setParam(":VCUST_ID", paramString);
    this.tradeQuery.executeBy(localUserExt.insBy("BAK_CUST_BY_CUSTID"));
    return 0;
  }

  public int DeleteCust(String paramString)
  {
    UserExt localUserExt = new UserExt();
    localUserExt.setParam(":VCUST_ID", paramString);
    this.tradeQuery.executeBy(localUserExt.insBy("DEL_CUST_BY_CUSTID"));
    return 0;
  }

  public void modifyUserInfo(Buffers paramBuffers)
  {
    this.outBuffer = paramBuffers;
    this.inBuffer = paramBuffers;
    this.log.LOG_INFO("进入modifyUserInfo方法...");
    int i = -1;
    try
    {
      UserDAO localUserDAO = new UserDAO();
      i = addUserInfo(localUserDAO);
    }
    catch (SaasApplicationException localSaasApplicationException)
    {
      this.log.LOG_INFO(localSaasApplicationException.getMessage());
    }
    if (i != 0)
    {
      this.outBuffer.setInt("RESULT_CODE", -1);
      this.outBuffer.setString("RESULT_INFO", "新增用户业务处理失败！");
    }
    else
    {
      this.outBuffer.setInt("RESULT_CODE", 0);
      this.outBuffer.setString("RESULT_INFO", "新增用户业务处理成功！");
    }
    this.log.LOG_INFO("退出modifyUserInfo方法...");
  }

  public int modifyUserInfo(UserDAO paramUserDAO)
    throws SaasApplicationException
  {
    UserExt localUserExt = new UserExt();
    this.tradeQuery.executeBy(localUserExt.insBy("INS_BY_ALL"));
    this.outBuffer.setString("USER_ID", paramUserDAO.getUser_id());
    this.outBuffer.setString("USER_NAME", paramUserDAO.getUser_name());
    this.log.LOG_INFO(" modifyUserInfo successful !");
    return 0;
  }

  public void editUserPassWord(Buffers paramBuffers)
  {
    this.outBuffer = paramBuffers;
    this.inBuffer = paramBuffers;
    this.log.LOG_INFO("进入editUserPassWord方法...");
    String str1 = paramBuffers.getString("USER_ID");
    String str2 = paramBuffers.getString("LASTPWD");
    MD5 localMD5 = new MD5();
    String str3 = localMD5.getMD5(str2.getBytes());
    log.LOG_DEBUG("---------------------------------------------------------------");
    log.LOG_DEBUG("user_id=" + str1);
    log.LOG_DEBUG("lastpwd=" + str2);
    log.LOG_DEBUG("---------------------------------------------------------------");
    int i = -1;
    try
    {
      i = editUserPassWord(str1, str3);
    }
    catch (SaasApplicationException localSaasApplicationException)
    {
      this.log.LOG_INFO(localSaasApplicationException.getMessage());
    }
    if (i != 0)
    {
      this.outBuffer.setInt("RESULT_CODE", -1);
      this.outBuffer.setString("RESULT_INFO", "新增用户业务处理失败！");
    }
    else
    {
      this.outBuffer.setInt("RESULT_CODE", 0);
      this.outBuffer.setString("RESULT_INFO", "新增用户业务处理成功！");
    }
    this.log.LOG_INFO("退出modifyUserInfo方法...");
  }

  public int editUserPassWord(String paramString1, String paramString2)
    throws SaasApplicationException
  {
    UserExt localUserExt = new UserExt();
    localUserExt.setParam(":VUSER_ID", paramString1);
    localUserExt.setParam(":VLASTPWD", paramString2);
    log.LOG_DEBUG("---------------------------------------------------------------");
    log.LOG_DEBUG("user_id=" + paramString1);
    log.LOG_DEBUG("lastpwd=" + paramString2);
    log.LOG_DEBUG("---------------------------------------------------------------");
    this.tradeQuery.executeBy(localUserExt.insBy("UPDATE_USERINFO_BY_PASSWORD"));
    this.log.LOG_INFO(" editUserPassWord successful !");
    return 0;
  }

  public ArrayList getUserSimpleInfoByUserId(String paramString)
  {
    UserExt localUserExt = new UserExt();
    localUserExt.setParam(":VUSER_ID", paramString);
    ArrayList localArrayList = localUserExt.selByList("SEL_SIMPLEINFO_BY_USERID");
    return localArrayList != null ? localArrayList : null;
  }

  public void updateUserStateById(String paramString1, String paramString2)
  {
    UserExt localUserExt = new UserExt();
    localUserExt.setParam(":VUSER_ID", paramString1);
    localUserExt.setParam(":VUSER_STATE", paramString2);
    this.tradeQuery.executeBy(localUserExt.insBy("UPDATE_USERSTATE_BY_USERID"));
  }

  public int gelActivation(String paramString)
  {
    int i = 2;
    String str = "select t1.activation from company t1 ,user_info t2 where t1.cust_id=t2.cust_id and t2.user_name ='" + paramString + "'";
    log.LOG_DEBUG(str);
   
    return i;
  }

  public String getPerRoleId()
  {
    String str1 = "";
    String str2 = "select distinct(t1.role_auth_id) from role t1,site_parameter t2 where t1.role_auth_id=t2.param_value and t2.param_name ='role_verifyed_person'";
  
    return str1;
  }

  public boolean audioPersonal(String paramString1, String paramString2, String paramString3, String paramString4, String paramString5)
  {
    String str1 = "update user_info set user_state=" + paramString5 + ",user_state_date=now(),check_time=now(),back_reason='" + paramString4 + "',check_user=" + paramString3 + " where cust_id=" + paramString1;
    String str2 = "update company set cust_state=" + paramString5 + ",check_user=" + paramString3 + ",check_time=now(),back_reason='" + paramString4 + "' where cust_id=" + paramString1;
    if (paramString5.equals("1"))
    {
      String str3 = getPerRoleId();
      str1 = "update user_info set user_state=" + paramString5 + ",user_state_date=now(),check_time=now(),back_reason='" + paramString4 + "',check_user=" + paramString3 + ", role_auth_id='" + str3 + "' where cust_id=" + paramString1;
    }
    new CommMethodMgr().upByInfoId(str2);
    new CommMethodMgr().upByInfoId(str1);
    return true;
  }

  public void setPermissions(String paramString1, String paramString2, String paramString3, int paramInt)
  {
    String str1 = "";
    String str2 = "";
    if (paramInt == 2)
      str2 = new ParamInfo().getParamName("role_verifyed_person");
    else if (paramInt == 1)
      str2 = new ParamInfo().getParamName("role_verifyed_company");
    String str3 = "";
    String str4 = "";
    String str5 = "";
    ArrayList localArrayList = new RoleInfo().getRoleInfoByCustName(str2);
    if ((localArrayList != null) && (localArrayList.size() > 0))
      for (int i = 0; i < localArrayList.size(); i++)
      {
        HashMap localHashMap = (HashMap)localArrayList.get(i);
        str3 = localHashMap.get("menu_id") != null ? localHashMap.get("menu_id").toString() : "";
        str4 = localHashMap.get("menu_name") != null ? localHashMap.get("menu_name").toString() : "";
        str5 = localHashMap.get("menu_path") != null ? localHashMap.get("menu_path").toString() : "";
        str1 = new CommGetId().getTradeId("authority", "auth_id");
        try
        {
          new CompanyInfo().insertCompanyToAuthority(Long.parseLong(str1), paramString1, paramString2, paramString3, str3, str4, str5, str2);
        }
        catch (SaasApplicationException localSaasApplicationException)
        {
          localSaasApplicationException.printStackTrace();
        }
      }
  }

  public int getActivation(String paramString)
  {
    String str = deEmail(paramString);
    return new CommMethodMgr().selIntByInfoId("company", "activation", "cust_id", str);
  }

  public int setActivation(String paramString)
  {
    int i = getActivation(paramString);
    if (i == 0)
    {
      String str1 = deEmail(paramString);
      String str2 = "update company set activation=1 where cust_id='" + str1 + "'";
    
    }
    return i;
  }

  public String deEmail(String paramString)
  {
    String str = "";
    try
    {
      Encryption localEncryption = new Encryption("hli_mail");
      str = localEncryption.decrypt(paramString);
    }
    catch (Exception localException)
    {
      localException.printStackTrace();
    }
    return str;
  }
}

